<?php
//
//  * @version $Id: mojo.html.php, v 0.16 2007/12/24 11:55:55 visualweb Exp $ 
//  * @package com_mojo
//  * @copyright (c) 1guywebdesign.com 
//  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL 
//  *
//  *	Refactored 2.1 code to reduce db queries and redundant code overhead
//  *	Posts and pages now inherit j template styles
//  *	RSS feed, Trackback now function as intended
//  *	Post Titles now h3 tags (same as joomla article titles)
//  * v0.16
//  * Begin refactoring themelette with microformat inheritance and styles
//  *	ADDED initial bottom joomla module container and sniff to display IF.
//
/*
// don't allow display -outside- of joomla environment  
	defined( '_VALID_MOS' ) or die( 'Restricted access' );
// include global joomla paths
	global $mosConfig_absolute_path, $mosConfig_live_site;
//
	require($mosConfig_absolute_path.'/components/com_mojo/wp-blog-header.php');

// com_mojo  (COMPONENT)	insert specific includes into head of template (VALID)
	$html = "<!--com_mojo-->\n";
	$html .= "<link href=\"" . $mosConfig_live_site . "/components/com_mojo/wp-content/themes/default/style.css\" rel=\"stylesheet\" type=\"text/css\" media=\"screen\"/>\n";	
	$html .= "<!--/com_mojo-->\n";
			
	$mainframe->addCustomHeadTag( $html );

// display mojo (home)
class HTML_wp {
	function wp_main () {
		global $mosConfig_absolute_path, $mosConfig_live_site, $wpdb, $Itemid, $database, $post;
		$Itemid = intval( mosGetParam( $_REQUEST, 'Itemid', 0 ) );
		$menu = new mosMenu( $database );
		$menu->load( $Itemid );
?>

<!--START:: mojo.html.php-->

<div id="mojo-main">
<!-- START FULL POSTS-->
<?php if (have_posts()) : ?>
		
<?php while (have_posts()) : the_post(); ?>
				
			<div id="mojo-post-<?php the_ID(); ?>" class="post" >
				<h3>
					<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a>
					<span class="userEdit"><?php edit_post_link('Edit this entry.','',''); ?></span>
				</h3>
				<div class="post-date"><?php the_time('F jS, Y') ?></div>
				<div class="post-author"> by <?php the_author() ?> </div>
				<div class="post-entry"><?php the_content('<span>Read the rest of this entry &raquo;</span>'); ?></div><!--/post-entry-->
			<?php if (is_single()) { ?>
			
			<div class="postmeta">
					<span>filed under <?php the_category(', ') ?> on <?php the_time('l, F jS, Y') ?>.<br />
												
						<?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
							// Both Comments and Pings are open ?>
							You can <a href="<?php echo sefRelToAbs( 'index.php?option=com_mojo&Itemid='.$Itemid.'&p='.$post->ID ) ?>#respond">comment</a>, or 
							<a href="<?php trackback_url(true); ?>" rel="trackback">trackback</a>. <br />
						
						<?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
							// Only Pings are Open ?>
							Comments are currently closed, but you can <a href="<?php trackback_url(true); ?> " rel="trackback">trackback</a> from your own site.
						
						<?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
							// Comments are open, Pings are not ?>
							You can skip to the end and leave a comment. Pinging is currently not allowed.
			
						<?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
							// Neither Comments, nor Pings are open ?>
							Both comments and pings are currently closed.			
						
						<?php }  ?>
						</span>
			</div><!--/postmeta-->
			
			<?php // bottom per post position for joomla modules
				 if(mosCountModules("bmojopost")){?>
				<div class="bmojopost">
					<div class="bmojoInner">
						<?php mosLoadModules ( 'bmojopost' ); ?>
					</div>
				</div><!--[end] mojoblog bottom module-->
			<?php } ?>
				
			</div><!--/mojo-post-->
			
			<?php comments_template(); ?>
			
			<?php } else { ?>
			<div class="postmeta">Posted in <?php the_category(', ') ?> | <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></div>
				
			</div><!--/mojo-post-->
	
			<?php } ?>
			
		<?php endwhile; ?>

		<div class="navigation">
			<span class="alignleft"><?php next_posts_link('&laquo; older posts') ?></span>
			<span class="alignright"><?php previous_posts_link('newer posts &raquo;') ?></span>
		</div>
		
<!--/POSTS-->
		
	<?php else : ?>

<!--START 404-->
		<div id="error">
		<h2>Not Found</h2>
		<p class="sorry">URP!! Sorry, but you are looking for something that isn't here.</p>
		</div>
<!--/404-->
	<?php endif; ?>

	</div>
<!--/mojo-main-->
<?php get_footer();
	}

// WP-PAGE DISPLAY --kdm	
	function wp_page () {
		global $mosConfig_absolute_path, $mosConfig_live_site, $wpdb, $Itemid, $database, $post;
		$Itemid = intval( mosGetParam( $_REQUEST, 'Itemid', 0 ) );
		$menu = new mosMenu( $database );
		$menu->load( $Itemid );
		mosCommonHTML::loadOverlib();
		?>

<div id="mojo-main">

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
		<div id="mojo-post-<?php the_ID(); ?>" class="post" >
		<h3><?php the_title(); ?><span class="userEdit"><?php edit_post_link('Edit this entry.', '', ''); ?></span></h3>
			<div class="entry">
				<?php the_content('<p>Read the rest of this page &raquo;</p>'); ?>
	
				<?php link_pages('<p><em>Pages:</em> ', '</p>', 'number'); ?>
	
			</div><!--/entry-->
		</div><!--/page-->
	  <?php endwhile; endif; ?>
	
	</div><!--/mojo-page-->
</div><!--/mojo-main-->
	<?php get_footer();
		}
	} 
*/
?>